package com.adminsystem.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.ArrayList;

/**
 * 菜单表
 * @TableName sys_menu
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value ="sys_menu")
@Data
public class SysMenu extends BaseEntity {
    /**
     * 菜单名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 菜单图标
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 父级菜单
     */
    @TableField(value = "parent_id")
    private Long parentId;

    /**
     * 菜单排序
     */
    @TableField(value = "order_num")
    private Long orderNum;

    /**
     * 菜单路径
     */
    @TableField(value = "path")
    private String path;

    /**
     * 前端路由组件路径
     */
    @TableField(value = "component")
    private String component;

    /**
     * 菜单类型
     */
    @TableField(value = "menu_type")
    private String menuType;

    /**
     * 菜单权限
     */
    @TableField(value = "perms")
    private String perms;

    /**
     * 是否显示
     */
    @TableField(value = "is_show")
    private int isShow;

    @TableField(exist = false)
    private List<SysMenu> children=new ArrayList<>();

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append(", id=").append(super.getId());
        sb.append(", name=").append(name);
        sb.append(", icon=").append(icon);
        sb.append(", parentId=").append(parentId);
        sb.append(", orderNum=").append(orderNum);
        sb.append(", path=").append(path);
        sb.append(", component=").append(component);
        sb.append(", menuType=").append(menuType);
        sb.append(", perms=").append(perms);
        sb.append(", creatTime=").append(super.getCreateTime());
        sb.append(", updateTime=").append(super.getUpdateTime());
        sb.append(", remark=").append(super.getRemark());
        sb.append("]");
        return sb.toString();
    }
}